clear

set scheme plotplain

use Data_Proc\recs_clean

keep if recs>=2009


* HEAT SHARES BY RECS FOR HOMES BUILT BEFORE 2010 (IN LEVELS)
eststo clear
local heatlist "hp elec ngas kero prop"
foreach h of local heatlist {
	eststo: reg `h' recs2009 recs2015 recs2020 if vintage<=2000 & heat==1 [pw=nweight], robust noconstant
}
esttab using Final_Output\tab_HeatSharesByRecs_OldHomes.tex, label replace order(recs2009 recs2015 recs2020) keep(recs2009 recs2015 recs2020) noconstant b(3) se(3) fragment substitute(\_ _) mtitle("HP" "Elec" "Gas" "Oil" "Prop")


* HEAT SHARES BY RECS FOR NEW HOMES IN 2009 AND 2020 (IN LEVELS)
eststo clear
local heatlist "hp elec ngas kero prop"
foreach h of local heatlist {
	eststo: reg `h' recs2009 recs2020 if (vintage==2000 & recs==2009 & heat==1) | (vintage==2010 & recs==2020 & heat==1) [pw=nweight], robust noconstant
}
esttab using Final_Output\tab_HeatSharesByRecs_NewHomes.tex, label replace order(recs2009 recs2020) keep(recs2009 recs2020) noconstant b(3) se(3) fragment substitute(\_ _) mtitle("HP" "Elec" "Gas" "Oil" "Prop")


* HEAT SHARES BY RECS FOR NEW HOMES IN 2009, 2015, AND 2020 (IN LEVELS)
eststo clear
local heatlist "hp elec ngas kero prop"
foreach h of local heatlist {
	eststo: reg `h' recs2009 recs2015 recs2020 if (vintage==2000 & recs==2009 & heat==1) | (vintage==2010 & recs==2015 & heat==1) | (vintage==2010 & recs==2020 & heat==1) [pw=nweight], robust noconstant
}
esttab using Final_Output\tab_HeatSharesByRecs_NewHomes_AllRecs.tex, label replace order(recs2009 recs2015 recs2020) keep(recs2009 recs2015 recs2020) noconstant b(3) se(3) fragment substitute(\_ _) mtitle("HP" "Elec" "Gas" "Oil" "Prop")


* HEAT SHARES BY RECS FOR HOMES BUILT BEFORE 2010 (RELATIVE TO RECS 2009)
eststo clear
local heatlist "hp elec ngas kero prop"
foreach h of local heatlist {
	eststo: reg `h' recs2015 recs2020 if vintage<=2000 & heat==1 [pw=nweight], robust
}
esttab using Final_Output\tab_HeatSharesByRecsVs2009_OldHomes.tex, label replace order(_cons recs2015 recs2020) keep(_cons recs2015 recs2020) b(3) se(3) fragment substitute(\_ _) mtitle("HP" "Elec" "Gas" "Oil" "Prop")


* HEAT SHARES BY RECS FOR HOMES BUILT BEFORE 2010 (RELATIVE TO RECS 2009), ADDING CONTROLS
eststo clear
local heatlist "hp elec ngas kero prop"
foreach h of local heatlist {
	eststo: reg `h' recs2015 recs2020 rural i.divisionc i.vintage if vintage<=2000 & heat==1 [pw=nweight], robust
}
esttab using Final_Output\tab_HeatSharesByRecsVs2009AddControls_OldHomes.tex, label replace order(recs2015 recs2020) keep(recs2015 recs2020) b(3) se(3) fragment substitute(\_ _) mtitle("HP" "Elec" "Gas" "Oil" "Prop")


* SHARE OF NEW VS. OLD HOMES IN 2020 RECS
tab vintage if recs==2020 & heat==1 [iw=nweight]


clear
exit
